package cn.dlc.com.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.dlc.com.service.StockService;

@RestController
@RequestMapping("lock")
public class LockRecordController {
	
	@Autowired
	private StockService stockService;

	@GetMapping("test")
	public String test() throws Exception{
		
		// 执行业务逻辑
//		boolean stock = stockService.reduceStock("1",1);
		boolean stock = stockService.reduceStockRedis("1",1);
		
		if(stock) {
			System.out.println("减少库存成功");
			return "减少库存成功";
		} else {
			System.out.println("减少库存失败！");
			return "减少库存失败！";
		}
	}
}
